<?php

namespace Application\pform\a_wan;

use Application\model\BaseOrderModel;

/**
 * @property string $platform 平台
 * @property string $channel 渠道子渠道ID
 * @property string $openId 平台用户ID
 * @property string $sid 游戏服务器ID
 * @property string $actorId 游戏角色ID
 * @property string $actorName 游戏角色名
 * @property string $shopId 商品ID
 * @property string $level 玩家角色等级
 * @property string $vipLevel  玩家角色VIP等级
 * @property string $ext  透传参数
 */
class OrderModel extends BaseOrderModel
{
    protected $auto_set_map = [
        'ccid' => 'channel',
        'account' => 'openId',
        'amount' => 'money',
        'vip' => 'vipLevel',
    ];

    /**
     *
     * @return void
     */
    protected function initPayParams()
    {
        $this->cpid = GAME_ID;
        $this->orderId = $this->cpid.date('YmdHis').rand(1000, 9999);
    }

    public function getRetunData($config){
        return [
            'orderId' => $this->orderId,
            'payNotifyUrl' => SCHEME."://{$_SERVER['HTTP_HOST']}/api/payment?platform=a_wan" ,
            'rate' => RADIO,
            'goodsId' => $config['id'],
            'goodsName' => $config['describe'],
            'money' => $config['amount'],
            'ext' => $this->get('ext')
        ];
    }
}